/* uDig - User Friendly Desktop Internet GIS client
 * http://udig.refractions.net
 * (C) 2004-2008, Refractions Research Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation;
 * version 2.1 of the License.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 */
package feature;

/**
 * is a named data value associated with a feature 
 * <p>
 *
 * </p>
 * @author John
 * @since 1.1.0
 */
public class Attribute {
    public String name;
    public enum Type {NUMBER, STRING};
    public double number;
    public String string;
    public Type type;
    
    public String getAsString()
    {
        if (type == Type.STRING)
            return string;
        else
            return Double.toString(number);
    }
    
    public double getAsNumber()
    {
        if (type == Type.NUMBER)
            return number;
        else
            return Double.NaN;
    }
    
}
